package com.kitty.game.task.service.taskHandler;

import com.kitty.game.config.TaskSet;
import com.kitty.game.role.model.Role;
import com.kitty.game.task.message.vo.TaskInfo;
import com.kitty.game.task.model.product.TaskType;
import com.kitty.game.utils.Const;
import org.springframework.stereotype.Component;

import java.text.MessageFormat;

/**试道大会任务处理类*/
@Component
public class ShiDaoTaskHandler extends TaskHandler {
    @Override
    public TaskType getTaskType() {
        return TaskType.SHIDAO;
    }

    @Override
    public TaskInfo getTaskInfo(Role role, TaskSet taskSet) {
        TaskInfo taskInfo = super.getTaskInfo(role, taskSet);
        String orderChinese = Const.ORDER_CHINESE.getOrDefault(Integer.parseInt(role.getExtendBox().getShidaoRank().split("\\|")[2]), null);
        if (orderChinese != null) {
            taskInfo.setTaskInfo(MessageFormat.format(taskInfo.getTaskInfo(), orderChinese));
        }

        return taskInfo;
    }
}
